import EventEmitter from 'events'
import { HashRouter } from 'react-router-dom'
import LocalStorage from 'localstorage'
// 事件总线
export const bus = new EventEmitter()
// 全局路由实例
export const router = new HashRouter()
// 通用LocalStorage工具
export const commonLs = new LocalStorage('commen_')
// 这玩意是怎么用的呢
//  跳回 登录页面
export const toLoginWithForm = (ins) => {
  console.log(ins, router)
  const { history } = (ins || router)
  const { pathname } = history.location
  console.log(pathname)
  router.history.push({ pathname: '/login', search: `?from=${pathname}` })
}
